<?php
namespace Admin\Controller;
use Think\Controller;
class MenuaddController extends AdminController {
    public function index(){
    	$this->yijimenu=M('Menu')->where('type=1')->select();
    	$this->display();
    }
    public function menuadd(){
    	$data['menu']=I('menu');
    	$data['type']=I('type');
    	if(I('yijimenu')){
    		$data['parentid']=I('yijimenu');
    	}else{
    		$data['parentid']=0;
    	}
    	$data['menu_ico']='&#'.I('menu_ico');
    	$data['controller']=I('controller');
    	$data['view']=I('view');
    	$data['beizhu']=I('beizhu');
    	if(M('Menu')->add($data)){
    		echo 1;
    	}else{
    		echo 2;
    	}
    }
}